﻿#include <iostream>
using namespace std;

class TV
{
public:
    TV(){}
    virtual ~TV(){}

    void On()
    {
        cout << "tv on" << endl;
    }

    void Off()
    {
        cout << "tv off" << endl;
    }
};

class Light
{
public:
    Light(){}
    virtual ~Light(){}

    void On()
    {
        cout << "Light on" << endl;
    }

    void Off()
    {
        cout << "Light off" << endl;
    }
};

class Audio
{
public:
    Audio(){}
    virtual ~Audio(){}

    void On()
    {
        cout << "audio on" << endl;
    }

    void Off()
    {
        cout << "audio off" << endl;
    }
};

class GameMachine
{
public:
    GameMachine(){}
    virtual ~GameMachine(){}

    void On()
    {
        cout << "game machine on" << endl;
    }

    void Off()
    {
        cout << "game machine off" << endl;
    }
};

class Mircophone
{
public:
    Mircophone(){}
    virtual ~Mircophone(){}

    void On()
    {
        cout << "mircophone on" << endl;
    }

    void Off()
    {
        cout << "mircophone off" << endl;
    }

};

class Dvdplay
{
public:
    Dvdplay(){}
    virtual ~Dvdplay(){}

    void On()
    {
        cout << "dvd on" << endl;
    }

    void Off()
    {
        cout << "dvd off" << endl;
    }
};

class KtvMode
{
public:
    KtvMode()
    {
        m_tv = new TV;
        m_audio = new Audio;
        m_dvd = new Dvdplay;
        m_light = new Light;
        m_phone = new Mircophone;
    }

    virtual ~KtvMode()
    {
        delete m_tv;
        delete m_audio;
        delete m_dvd;
        delete m_light;
        delete m_phone;
    }

    void On()
    {
        m_phone->On();
        m_audio->On();
        m_dvd->On();
        m_tv->On();
        m_light->On();
    }

    void Off()
    {
        m_phone->Off();
        m_audio->Off();
        m_dvd->Off();
        m_tv->Off();
        m_light->Off();
    }
private:
    TV *m_tv;
    Mircophone* m_phone;
    Light* m_light;
    Dvdplay* m_dvd;
    Audio* m_audio;
};

int main()
{
    KtvMode* ktv = new KtvMode();

    ktv->On();

    ktv->Off();
    
    delete ktv;
    return 0;
}
